package cn.shafish.jdkspi;

import cn.shafish.jdkspi.service.UserService;

import java.util.Iterator;
import java.util.ServiceLoader;

public class JdkSpiTest {
    public static void main(String[] args) {
        ServiceLoader<UserService> load = ServiceLoader.load(UserService.class);
        Iterator<UserService> iterator = load.iterator();
        while(iterator.hasNext()) {
            UserService next = iterator.next();
            next.sayHello();
        }
    }
}
